declare const $: any;
const scrollWidth = (() => {
  let noScroll, scroll, oDiv = document.createElement("div");
  oDiv.style.cssText = "position:absolute; top:-9999px; width:100px; height:100px; overflow:hidden;";        
  noScroll = document.body.appendChild(oDiv).clientWidth;
  oDiv.style.overflowY = "scroll";
  scroll = oDiv.clientWidth;
  document.body.removeChild(oDiv);
  return noScroll-scroll;
})();
const bodyMarginRight = (() => {
  const currStyle = getComputedStyle(document.body);
  return parseFloat(currStyle['marginRight']);
})()
export function removeBodyScroll() {
  $('body').addClass('no-scroll').css('marginRight', `${bodyMarginRight + scrollWidth}px`);
}

export function addBodyScroll() {
  $('body').removeClass('no-scroll').css('marginRight', `${parseFloat($('body').css('marginRight')) - scrollWidth}px`);
}